package myLesson3;

import java.util.Scanner;

public class TwoDemen {
	public static void main(String[] args) {
		int[][] array = new int[4][5];
		int n, m;
		Scanner sc = new Scanner(System.in);
		System.out.println("Enter number of rows ");
		n = sc.nextInt();
		System.out.println("Enter number of col ");
		m = sc.nextInt();
		array = new int[n][m];
		for (int row = 0; row < array.length; row++) {
			for (int col = 0; col < array[row].length; col++) {
				System.out.println("row " + row + "col" + col);
				array[row][col] = sc.nextInt();
			}
		}
		if (array.length > 0) {
			
			int max =array[array.length - 1][array.length-1];
			int min = array[0][0];
			int sum = 0;
			for (int row = 0; row < array.length; row++) {
				for (int col = 0; col < array[row].length; col++) {
				if (array[row][col] > max) {
					max = array[row][col];
				}

				if (array[row][col] < min) {
					min = array[row][col];
				}
				sum += array[row][col];
			}
			
			
		}
			System.out.println("min " + min + " max " + max + " sum " + sum);
			System.out.println();
		}
	}
}
